/*
 * Copyright 2016 Netflix, Inc.
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

/* PartitionParser.java */
/* Generated By:JJTree&JavaCC: Do not edit this line. PartitionParser.java */
package com.netflix.metacat.common.server.partition.parser;

public class PartitionParser/*@bgen(jjtree)*/ implements PartitionParserTreeConstants, PartitionParserConstants {/*@bgen(jjtree)*/
    protected JJTPartitionParserState jjtree = new JJTPartitionParserState();

    public static void main(String args[]) throws ParseException {
        PartitionParser parser = new PartitionParser(new java.io.StringReader(args[0]));
        SimpleNode root = parser.filter();
        root.dump("");
        System.out
            .println(root.jjtAccept(new com.netflix.metacat.common.server.partition.visitor.PartitionParserEval(), null));
    }

    final public SimpleNode filter() throws ParseException {/*@bgen(jjtree) FILTER */
        ASTFILTER jjtn000 = new ASTFILTER(JJTFILTER);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        try {
            expr();
            jj_consume_token(0);
            jjtree.closeNodeScope(jjtn000, true);
            jjtc000 = false;
            {if ("" != null) return jjtn000;}
        } catch (Throwable jjte000) {
            if (jjtc000) {
                jjtree.clearNodeScope(jjtn000);
                jjtc000 = false;
            } else {
                jjtree.popNode();
            }
            if (jjte000 instanceof RuntimeException) {
                {if (true) throw (RuntimeException) jjte000;}
            }
            if (jjte000 instanceof ParseException) {
                {if (true) throw (ParseException) jjte000;}
            }
            {if (true) throw (Error) jjte000;}
        } finally {
            if (jjtc000) {
                jjtree.closeNodeScope(jjtn000, true);
            }
        }
        throw new Error("Missing return statement in function");
    }

    final public void expr() throws ParseException {
        switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
        case LPAREN: {
            jj_consume_token(LPAREN);
            expr();
            jj_consume_token(RPAREN);
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case AND:
            case OR: {
                switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case AND: {
                    jj_consume_token(AND);
                    ASTAND jjtn001 = new ASTAND(JJTAND);
                    boolean jjtc001 = true;
                    jjtree.openNodeScope(jjtn001);
                    try {
                        expr();
                    } catch (Throwable jjte001) {
                        if (jjtc001) {
                            jjtree.clearNodeScope(jjtn001);
                            jjtc001 = false;
                        } else {
                            jjtree.popNode();
                        }
                        if (jjte001 instanceof RuntimeException) {
                            {if (true) throw (RuntimeException) jjte001;}
                        }
                        if (jjte001 instanceof ParseException) {
                            {if (true) throw (ParseException) jjte001;}
                        }
                        {if (true) throw (Error) jjte001;}
                    } finally {
                        if (jjtc001) {
                            jjtree.closeNodeScope(jjtn001, 2);
                        }
                    }
                    break;
                }
                case OR: {
                    jj_consume_token(OR);
                    ASTOR jjtn002 = new ASTOR(JJTOR);
                    boolean jjtc002 = true;
                    jjtree.openNodeScope(jjtn002);
                    try {
                        expr();
                    } catch (Throwable jjte002) {
                        if (jjtc002) {
                            jjtree.clearNodeScope(jjtn002);
                            jjtc002 = false;
                        } else {
                            jjtree.popNode();
                        }
                        if (jjte002 instanceof RuntimeException) {
                            {if (true) throw (RuntimeException) jjte002;}
                        }
                        if (jjte002 instanceof ParseException) {
                            {if (true) throw (ParseException) jjte002;}
                        }
                        {if (true) throw (Error) jjte002;}
                    } finally {
                        if (jjtc002) {
                            jjtree.closeNodeScope(jjtn002, 2);
                        }
                    }
                    break;
                }
                default:
                    jj_la1[0] = jj_gen;
                    jj_consume_token(-1);
                    throw new ParseException();
                }
                break;
            }
            default:
                jj_la1[1] = jj_gen;
                ;
            }
            break;
        }
        default:
            jj_la1[4] = jj_gen;
            if (jj_2_1(1)) {
                EvalExpr();
                switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case AND:
                case OR: {
                    switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                    case AND: {
                        jj_consume_token(AND);
                        ASTAND jjtn003 = new ASTAND(JJTAND);
                        boolean jjtc003 = true;
                        jjtree.openNodeScope(jjtn003);
                        try {
                            expr();
                        } catch (Throwable jjte003) {
                            if (jjtc003) {
                                jjtree.clearNodeScope(jjtn003);
                                jjtc003 = false;
                            } else {
                                jjtree.popNode();
                            }
                            if (jjte003 instanceof RuntimeException) {
                                {if (true) throw (RuntimeException) jjte003;}
                            }
                            if (jjte003 instanceof ParseException) {
                                {if (true) throw (ParseException) jjte003;}
                            }
                            {if (true) throw (Error) jjte003;}
                        } finally {
                            if (jjtc003) {
                                jjtree.closeNodeScope(jjtn003, 2);
                            }
                        }
                        break;
                    }
                    case OR: {
                        jj_consume_token(OR);
                        ASTOR jjtn004 = new ASTOR(JJTOR);
                        boolean jjtc004 = true;
                        jjtree.openNodeScope(jjtn004);
                        try {
                            expr();
                        } catch (Throwable jjte004) {
                            if (jjtc004) {
                                jjtree.clearNodeScope(jjtn004);
                                jjtc004 = false;
                            } else {
                                jjtree.popNode();
                            }
                            if (jjte004 instanceof RuntimeException) {
                                {if (true) throw (RuntimeException) jjte004;}
                            }
                            if (jjte004 instanceof ParseException) {
                                {if (true) throw (ParseException) jjte004;}
                            }
                            {if (true) throw (Error) jjte004;}
                        } finally {
                            if (jjtc004) {
                                jjtree.closeNodeScope(jjtn004, 2);
                            }
                        }
                        break;
                    }
                    default:
                        jj_la1[2] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                    }
                    break;
                }
                default:
                    jj_la1[3] = jj_gen;
                    ;
                }
            } else {
                jj_consume_token(-1);
                throw new ParseException();
            }
        }
    }

    final public void EvalExpr() throws ParseException {
        boolean not = false;
        ASTNOT jjtn001 = new ASTNOT(JJTNOT);
        boolean jjtc001 = true;
        jjtree.openNodeScope(jjtn001);
        try {
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case NOT: {
                jj_consume_token(NOT);
                not = true;
                break;
            }
            default:
                jj_la1[5] = jj_gen;
                ;
            }
            eval();
        } catch (Throwable jjte001) {
            if (jjtc001) {
                jjtree.clearNodeScope(jjtn001);
                jjtc001 = false;
            } else {
                jjtree.popNode();
            }
            if (jjte001 instanceof RuntimeException) {
                {if (true) throw (RuntimeException) jjte001;}
            }
            if (jjte001 instanceof ParseException) {
                {if (true) throw (ParseException) jjte001;}
            }
            {if (true) throw (Error) jjte001;}
        } finally {
            if (jjtc001) {
                jjtree.closeNodeScope(jjtn001, not);
            }
        }
    }

    final public void eval() throws ParseException {
        if (getToken(2).kind == BETWEEN || getToken(3).kind == BETWEEN) {
            BetweenEval();
        } else if (getToken(2).kind == IN || getToken(3).kind == IN) {
            InEval();
        } else if (getToken(2).kind == LIKE || getToken(3).kind == LIKE) {
            LikeEval();
        } else {
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case INT:
            case FLOAT:
            case BOOLEAN:
            case VARIABLE:
            case QUOTE:
            case SQUOTE: {
                CompareEval();
                break;
            }
            default:
                jj_la1[6] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
            }
        }
    }

    final public void BetweenEval() throws ParseException {/*@bgen(jjtree) BETWEEN */
        ASTBETWEEN jjtn000 = new ASTBETWEEN(JJTBETWEEN);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        try {
            term();
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case NOT: {
                jj_consume_token(NOT);
                jjtn000.not = true;
                break;
            }
            default:
                jj_la1[7] = jj_gen;
                ;
            }
            jj_consume_token(BETWEEN);
            term();
            jj_consume_token(AND);
            term();
        } catch (Throwable jjte000) {
            if (jjtc000) {
                jjtree.clearNodeScope(jjtn000);
                jjtc000 = false;
            } else {
                jjtree.popNode();
            }
            if (jjte000 instanceof RuntimeException) {
                {if (true) throw (RuntimeException) jjte000;}
            }
            if (jjte000 instanceof ParseException) {
                {if (true) throw (ParseException) jjte000;}
            }
            {if (true) throw (Error) jjte000;}
        } finally {
            if (jjtc000) {
                jjtree.closeNodeScope(jjtn000, true);
            }
        }
    }

    final public void InEval() throws ParseException {/*@bgen(jjtree) IN */
        ASTIN jjtn000 = new ASTIN(JJTIN);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        try {
            term();
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case NOT: {
                jj_consume_token(NOT);
                jjtn000.not = true;
                break;
            }
            default:
                jj_la1[8] = jj_gen;
                ;
            }
            jj_consume_token(IN);
            jj_consume_token(LPAREN);
            term();
            label_1:
            while (true) {
                switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case COMMA: {
                    ;
                    break;
                }
                default:
                    jj_la1[9] = jj_gen;
                    break label_1;
                }
                jj_consume_token(COMMA);
                term();
            }
            jj_consume_token(RPAREN);
        } catch (Throwable jjte000) {
            if (jjtc000) {
                jjtree.clearNodeScope(jjtn000);
                jjtc000 = false;
            } else {
                jjtree.popNode();
            }
            if (jjte000 instanceof RuntimeException) {
                {if (true) throw (RuntimeException) jjte000;}
            }
            if (jjte000 instanceof ParseException) {
                {if (true) throw (ParseException) jjte000;}
            }
            {if (true) throw (Error) jjte000;}
        } finally {
            if (jjtc000) {
                jjtree.closeNodeScope(jjtn000, true);
            }
        }
    }

    final public void LikeEval() throws ParseException {/*@bgen(jjtree) LIKE */
        ASTLIKE jjtn000 = new ASTLIKE(JJTLIKE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        try {
            term();
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case NOT: {
                jj_consume_token(NOT);
                jjtn000.not = true;
                break;
            }
            default:
                jj_la1[10] = jj_gen;
                ;
            }
            jj_consume_token(LIKE);
            term();
        } catch (Throwable jjte000) {
            if (jjtc000) {
                jjtree.clearNodeScope(jjtn000);
                jjtc000 = false;
            } else {
                jjtree.popNode();
            }
            if (jjte000 instanceof RuntimeException) {
                {if (true) throw (RuntimeException) jjte000;}
            }
            if (jjte000 instanceof ParseException) {
                {if (true) throw (ParseException) jjte000;}
            }
            {if (true) throw (Error) jjte000;}
        } finally {
            if (jjtc000) {
                jjtree.closeNodeScope(jjtn000, true);
            }
        }
    }

    final public void CompareEval() throws ParseException {/*@bgen(jjtree) COMPARE */
        ASTCOMPARE jjtn000 = new ASTCOMPARE(JJTCOMPARE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
        try {
            term();
            switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
            case EQUAL:
            case NEQUAL:
            case GTE:
            case GT:
            case LTE:
            case LT:
            case MATCHES: {
                comp();
                term();
                break;
            }
            default:
                jj_la1[11] = jj_gen;
                ;
            }
        } catch (Throwable jjte000) {
            if (jjtc000) {
                jjtree.clearNodeScope(jjtn000);
                jjtc000 = false;
            } else {
                jjtree.popNode();
            }
            if (jjte000 instanceof RuntimeException) {
                {if (true) throw (RuntimeException) jjte000;}
            }
            if (jjte000 instanceof ParseException) {
                {if (true) throw (ParseException) jjte000;}
            }
            {if (true) throw (Error) jjte000;}
        } finally {
            if (jjtc000) {
                jjtree.closeNodeScope(jjtn000, true);
            }
        }
    }

    final public void comp() throws ParseException {
        switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
        case GT: {
            ASTGT jjtn001 = new ASTGT(JJTGT);
            boolean jjtc001 = true;
            jjtree.openNodeScope(jjtn001);
            try {
                jj_consume_token(GT);
            } finally {
                if (jjtc001) {
                    jjtree.closeNodeScope(jjtn001, true);
                }
            }
            break;
        }
        case LT: {
            ASTLT jjtn002 = new ASTLT(JJTLT);
            boolean jjtc002 = true;
            jjtree.openNodeScope(jjtn002);
            try {
                jj_consume_token(LT);
            } finally {
                if (jjtc002) {
                    jjtree.closeNodeScope(jjtn002, true);
                }
            }
            break;
        }
        case LTE: {
            ASTLTE jjtn003 = new ASTLTE(JJTLTE);
            boolean jjtc003 = true;
            jjtree.openNodeScope(jjtn003);
            try {
                jj_consume_token(LTE);
            } finally {
                if (jjtc003) {
                    jjtree.closeNodeScope(jjtn003, true);
                }
            }
            break;
        }
        case GTE: {
            ASTGTE jjtn004 = new ASTGTE(JJTGTE);
            boolean jjtc004 = true;
            jjtree.openNodeScope(jjtn004);
            try {
                jj_consume_token(GTE);
            } finally {
                if (jjtc004) {
                    jjtree.closeNodeScope(jjtn004, true);
                }
            }
            break;
        }
        case EQUAL: {
            ASTEQ jjtn005 = new ASTEQ(JJTEQ);
            boolean jjtc005 = true;
            jjtree.openNodeScope(jjtn005);
            try {
                jj_consume_token(EQUAL);
            } finally {
                if (jjtc005) {
                    jjtree.closeNodeScope(jjtn005, true);
                }
            }
            break;
        }
        case NEQUAL: {
            ASTNEQ jjtn006 = new ASTNEQ(JJTNEQ);
            boolean jjtc006 = true;
            jjtree.openNodeScope(jjtn006);
            try {
                jj_consume_token(NEQUAL);
            } finally {
                if (jjtc006) {
                    jjtree.closeNodeScope(jjtn006, true);
                }
            }
            break;
        }
        case MATCHES: {
            ASTMATCHES jjtn007 = new ASTMATCHES(JJTMATCHES);
            boolean jjtc007 = true;
            jjtree.openNodeScope(jjtn007);
            try {
                jj_consume_token(MATCHES);
            } finally {
                if (jjtc007) {
                    jjtree.closeNodeScope(jjtn007, true);
                }
            }
            break;
        }
        default:
            jj_la1[12] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
        }
    }

    final public void term() throws ParseException {
        Token t;
        StringBuilder builder = new StringBuilder();
        switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
        case INT: {
            t = jj_consume_token(INT);
            ASTNUM jjtn001 = new ASTNUM(JJTNUM);
            boolean jjtc001 = true;
            jjtree.openNodeScope(jjtn001);
            try {
                jjtree.closeNodeScope(jjtn001, true);
                jjtc001 = false;
                jjtn001.value = new java.math.BigDecimal(t.image);
            } finally {
                if (jjtc001) {
                    jjtree.closeNodeScope(jjtn001, true);
                }
            }
            break;
        }
        case FLOAT: {
            t = jj_consume_token(FLOAT);
            ASTNUM jjtn002 = new ASTNUM(JJTNUM);
            boolean jjtc002 = true;
            jjtree.openNodeScope(jjtn002);
            try {
                jjtree.closeNodeScope(jjtn002, true);
                jjtc002 = false;
                jjtn002.value = new java.math.BigDecimal(t.image);
            } finally {
                if (jjtc002) {
                    jjtree.closeNodeScope(jjtn002, true);
                }
            }
            break;
        }
        case QUOTE: {
            jj_consume_token(QUOTE);
            label_2:
            while (true) {
                switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case CHAR: {
                    ;
                    break;
                }
                default:
                    jj_la1[13] = jj_gen;
                    break label_2;
                }
                t = jj_consume_token(CHAR);
                builder.append(t.image);
            }
            jj_consume_token(ENDQUOTE);
            ASTSTRING jjtn003 = new ASTSTRING(JJTSTRING);
            boolean jjtc003 = true;
            jjtree.openNodeScope(jjtn003);
            try {
                jjtree.closeNodeScope(jjtn003, true);
                jjtc003 = false;
                jjtn003.value = builder.toString();
            } finally {
                if (jjtc003) {
                    jjtree.closeNodeScope(jjtn003, true);
                }
            }
            break;
        }
        case SQUOTE: {
            jj_consume_token(SQUOTE);
            label_3:
            while (true) {
                switch ((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
                case SCHAR: {
                    ;
                    break;
                }
                default:
                    jj_la1[14] = jj_gen;
                    break label_3;
                }
                t = jj_consume_token(SCHAR);
                builder.append(t.image);
            }
            jj_consume_token(SENDQUOTE);
            ASTSTRING jjtn004 = new ASTSTRING(JJTSTRING);
            boolean jjtc004 = true;
            jjtree.openNodeScope(jjtn004);
            try {
                jjtree.closeNodeScope(jjtn004, true);
                jjtc004 = false;
                jjtn004.value = builder.toString();
            } finally {
                if (jjtc004) {
                    jjtree.closeNodeScope(jjtn004, true);
                }
            }
            break;
        }
        case BOOLEAN: {
            t = jj_consume_token(BOOLEAN);
            ASTBOOLEAN jjtn005 = new ASTBOOLEAN(JJTBOOLEAN);
            boolean jjtc005 = true;
            jjtree.openNodeScope(jjtn005);
            try {
                jjtree.closeNodeScope(jjtn005, true);
                jjtc005 = false;
                jjtn005.value = t.image;
            } finally {
                if (jjtc005) {
                    jjtree.closeNodeScope(jjtn005, true);
                }
            }
            break;
        }
        case VARIABLE: {
            t = jj_consume_token(VARIABLE);
            ASTVAR jjtn006 = new ASTVAR(JJTVAR);
            boolean jjtc006 = true;
            jjtree.openNodeScope(jjtn006);
            try {
                jjtree.closeNodeScope(jjtn006, true);
                jjtc006 = false;
                jjtn006.value = new Variable(t.image);
            } finally {
                if (jjtc006) {
                    jjtree.closeNodeScope(jjtn006, true);
                }
            }
            break;
        }
        default:
            jj_la1[15] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
        }
    }

    private boolean jj_2_1(int xla) {
        jj_la = xla;
        jj_lastpos = jj_scanpos = token;
        try { return !jj_3_1(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); }
    }

    private boolean jj_3R_9() {
        if (jj_3R_13()) return true;
        return false;
    }

    private boolean jj_3R_21() {
        if (jj_scan_token(VARIABLE)) return true;
        return false;
    }

    private boolean jj_3R_8() {
        if (jj_3R_12()) return true;
        return false;
    }

    private boolean jj_3R_5() {
        if (jj_scan_token(NOT)) return true;
        return false;
    }

    private boolean jj_3R_20() {
        if (jj_scan_token(BOOLEAN)) return true;
        return false;
    }

    private boolean jj_3R_7() {
        if (jj_3R_11()) return true;
        return false;
    }

    private boolean jj_3R_6() {
        Token xsp;
        xsp = jj_scanpos;
        jj_lookingAhead = true;
        jj_semLA = getToken(2).kind == BETWEEN || getToken(3).kind == BETWEEN;
        jj_lookingAhead = false;
        if (!jj_semLA || jj_3R_7()) {
            jj_scanpos = xsp;
            jj_lookingAhead = true;
            jj_semLA = getToken(2).kind == IN || getToken(3).kind == IN;
            jj_lookingAhead = false;
            if (!jj_semLA || jj_3R_8()) {
                jj_scanpos = xsp;
                jj_lookingAhead = true;
                jj_semLA = getToken(2).kind == LIKE || getToken(3).kind == LIKE;
                jj_lookingAhead = false;
                if (!jj_semLA || jj_3R_9()) {
                    jj_scanpos = xsp;
                    if (jj_3R_10()) return true;
                }
            }
        }
        return false;
    }

    private boolean jj_3R_19() {
        if (jj_scan_token(SQUOTE)) return true;
        return false;
    }

    private boolean jj_3R_4() {
        Token xsp;
        xsp = jj_scanpos;
        if (jj_3R_5()) jj_scanpos = xsp;
        if (jj_3R_6()) return true;
        return false;
    }

    private boolean jj_3R_18() {
        if (jj_scan_token(QUOTE)) return true;
        return false;
    }

    private boolean jj_3R_17() {
        if (jj_scan_token(FLOAT)) return true;
        return false;
    }

    private boolean jj_3R_15() {
        Token xsp;
        xsp = jj_scanpos;
        if (jj_3R_16()) {
            jj_scanpos = xsp;
            if (jj_3R_17()) {
                jj_scanpos = xsp;
                if (jj_3R_18()) {
                    jj_scanpos = xsp;
                    if (jj_3R_19()) {
                        jj_scanpos = xsp;
                        if (jj_3R_20()) {
                            jj_scanpos = xsp;
                            if (jj_3R_21()) return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    private boolean jj_3R_16() {
        if (jj_scan_token(INT)) return true;
        return false;
    }

    private boolean jj_3_1() {
        if (jj_3R_4()) return true;
        return false;
    }

    private boolean jj_3R_14() {
        if (jj_3R_15()) return true;
        return false;
    }

    private boolean jj_3R_13() {
        if (jj_3R_15()) return true;
        return false;
    }

    private boolean jj_3R_12() {
        if (jj_3R_15()) return true;
        return false;
    }

    private boolean jj_3R_11() {
        if (jj_3R_15()) return true;
        return false;
    }

    private boolean jj_3R_10() {
        if (jj_3R_14()) return true;
        return false;
    }

    /** Generated Token Manager. */
    public PartitionParserTokenManager token_source;
    SimpleCharStream jj_input_stream;
    /** Current token. */
    public Token token;
    /** Next token. */
    public Token jj_nt;
    private int jj_ntk;
    private Token jj_scanpos, jj_lastpos;
    private int jj_la;
    /** Whether we are looking ahead. */
    private boolean jj_lookingAhead = false;
    private boolean jj_semLA;
    private int jj_gen;
    final private int[] jj_la1 = new int[16];
    static private int[] jj_la1_0;
    static private int[] jj_la1_1;

    static {
        jj_la1_init_0();
        jj_la1_init_1();
    }

    private static void jj_la1_init_0() {
        jj_la1_0 = new int[] { 0xc0000, 0xc0000, 0xc0000, 0xc0000, 0x200, 0x100000, 0x36005000, 0x100000, 0x100000,
            0x800, 0x100000, 0x2001f8, 0x2001f8, 0x80000000, 0x0, 0x36005000, };
    }

    private static void jj_la1_init_1() {
        jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, };
    }

    final private JJCalls[] jj_2_rtns = new JJCalls[1];
    private boolean jj_rescan = false;
    private int jj_gc = 0;

    /** Constructor with InputStream. */
    public PartitionParser(java.io.InputStream stream) {
        this(stream, null);
    }

    /** Constructor with InputStream and supplied encoding */
    public PartitionParser(java.io.InputStream stream, String encoding) {
        try {
            jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
        } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
        token_source = new PartitionParserTokenManager(jj_input_stream);
        token = new Token();
        jj_ntk = -1;
        jj_gen = 0;
        for (int i = 0; i < 16; i++) jj_la1[i] = -1;
        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
    }

    /** Reinitialise. */
    public void ReInit(java.io.InputStream stream) {
        ReInit(stream, null);
    }

    /** Reinitialise. */
    public void ReInit(java.io.InputStream stream, String encoding) {
        try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch (java.io.UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        token_source.ReInit(jj_input_stream);
        token = new Token();
        jj_ntk = -1;
        jjtree.reset();
        jj_gen = 0;
        for (int i = 0; i < 16; i++) jj_la1[i] = -1;
        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
    }

    /** Constructor. */
    public PartitionParser(java.io.Reader stream) {
        jj_input_stream = new SimpleCharStream(stream, 1, 1);
        token_source = new PartitionParserTokenManager(jj_input_stream);
        token = new Token();
        jj_ntk = -1;
        jj_gen = 0;
        for (int i = 0; i < 16; i++) jj_la1[i] = -1;
        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
    }

    /** Reinitialise. */
    public void ReInit(java.io.Reader stream) {
        if (jj_input_stream == null) {
            jj_input_stream = new SimpleCharStream(stream, 1, 1);
        } else {
            jj_input_stream.ReInit(stream, 1, 1);
        }
        if (token_source == null) {
            token_source = new PartitionParserTokenManager(jj_input_stream);
        }

        token_source.ReInit(jj_input_stream);
        token = new Token();
        jj_ntk = -1;
        jjtree.reset();
        jj_gen = 0;
        for (int i = 0; i < 16; i++) jj_la1[i] = -1;
        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
    }

    /** Constructor with generated Token Manager. */
    public PartitionParser(PartitionParserTokenManager tm) {
        token_source = tm;
        token = new Token();
        jj_ntk = -1;
        jj_gen = 0;
        for (int i = 0; i < 16; i++) jj_la1[i] = -1;
        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
    }

    /** Reinitialise. */
    public void ReInit(PartitionParserTokenManager tm) {
        token_source = tm;
        token = new Token();
        jj_ntk = -1;
        jjtree.reset();
        jj_gen = 0;
        for (int i = 0; i < 16; i++) jj_la1[i] = -1;
        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
    }

    private Token jj_consume_token(int kind) throws ParseException {
        Token oldToken;
        if ((oldToken = token).next != null) token = token.next;
        else token = token.next = token_source.getNextToken();
        jj_ntk = -1;
        if (token.kind == kind) {
            jj_gen++;
            if (++jj_gc > 100) {
                jj_gc = 0;
                for (int i = 0; i < jj_2_rtns.length; i++) {
                    JJCalls c = jj_2_rtns[i];
                    while (c != null) {
                        if (c.gen < jj_gen) c.first = null;
                        c = c.next;
                    }
                }
            }
            return token;
        }
        token = oldToken;
        jj_kind = kind;
        throw generateParseException();
    }

    @SuppressWarnings("serial")
    static private final class LookaheadSuccess extends java.lang.Error {
    }

    final private LookaheadSuccess jj_ls = new LookaheadSuccess();

    private boolean jj_scan_token(int kind) {
        if (jj_scanpos == jj_lastpos) {
            jj_la--;
            if (jj_scanpos.next == null) {
                jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
            } else {
                jj_lastpos = jj_scanpos = jj_scanpos.next;
            }
        } else {
            jj_scanpos = jj_scanpos.next;
        }
        if (jj_rescan) {
            int i = 0;
            Token tok = token;
            while (tok != null && tok != jj_scanpos) {
                i++;
                tok = tok.next;
            }
            if (tok != null) jj_add_error_token(kind, i);
        }
        if (jj_scanpos.kind != kind) return true;
        if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
        return false;
    }

    /** Get the next Token. */
    final public Token getNextToken() {
        if (token.next != null) token = token.next;
        else token = token.next = token_source.getNextToken();
        jj_ntk = -1;
        jj_gen++;
        return token;
    }

    /** Get the specific Token. */
    final public Token getToken(int index) {
        Token t = jj_lookingAhead ? jj_scanpos : token;
        for (int i = 0; i < index; i++) {
            if (t.next != null) t = t.next;
            else t = t.next = token_source.getNextToken();
        }
        return t;
    }

    private int jj_ntk_f() {
        if ((jj_nt = token.next) == null)
            return (jj_ntk = (token.next = token_source.getNextToken()).kind);
        else
            return (jj_ntk = jj_nt.kind);
    }

    private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
    private int[] jj_expentry;
    private int jj_kind = -1;
    private int[] jj_lasttokens = new int[100];
    private int jj_endpos;

    private void jj_add_error_token(int kind, int pos) {
        if (pos >= 100) {
            return;
        }

        if (pos == jj_endpos + 1) {
            jj_lasttokens[jj_endpos++] = kind;
        } else if (jj_endpos != 0) {
            jj_expentry = new int[jj_endpos];

            for (int i = 0; i < jj_endpos; i++) {
                jj_expentry[i] = jj_lasttokens[i];
            }

            for (int[] oldentry : jj_expentries) {
                if (oldentry.length == jj_expentry.length) {
                    boolean isMatched = true;

                    for (int i = 0; i < jj_expentry.length; i++) {
                        if (oldentry[i] != jj_expentry[i]) {
                            isMatched = false;
                            break;
                        }

                    }
                    if (isMatched) {
                        jj_expentries.add(jj_expentry);
                        break;
                    }
                }
            }

            if (pos != 0) {
                jj_lasttokens[(jj_endpos = pos) - 1] = kind;
            }
        }
    }

    /** Generate ParseException. */
    public ParseException generateParseException() {
        jj_expentries.clear();
        boolean[] la1tokens = new boolean[34];
        if (jj_kind >= 0) {
            la1tokens[jj_kind] = true;
            jj_kind = -1;
        }
        for (int i = 0; i < 16; i++) {
            if (jj_la1[i] == jj_gen) {
                for (int j = 0; j < 32; j++) {
                    if ((jj_la1_0[i] & (1 << j)) != 0) {
                        la1tokens[j] = true;
                    }
                    if ((jj_la1_1[i] & (1 << j)) != 0) {
                        la1tokens[32 + j] = true;
                    }
                }
            }
        }
        for (int i = 0; i < 34; i++) {
            if (la1tokens[i]) {
                jj_expentry = new int[1];
                jj_expentry[0] = i;
                jj_expentries.add(jj_expentry);
            }
        }
        jj_endpos = 0;
        jj_rescan_token();
        jj_add_error_token(0, 0);
        int[][] exptokseq = new int[jj_expentries.size()][];
        for (int i = 0; i < jj_expentries.size(); i++) {
            exptokseq[i] = jj_expentries.get(i);
        }
        return new ParseException(token, exptokseq, tokenImage);
    }

    /** Enable tracing. */
    final public void enable_tracing() {
    }

    /** Disable tracing. */
    final public void disable_tracing() {
    }

    private void jj_rescan_token() {
        jj_rescan = true;
        for (int i = 0; i < 1; i++) {
            try {
                JJCalls p = jj_2_rtns[i];

                do {
                    if (p.gen > jj_gen) {
                        jj_la = p.arg;
                        jj_lastpos = jj_scanpos = p.first;
                        switch (i) {
                        case 0:
                            jj_3_1();
                            break;
                        }
                    }
                    p = p.next;
                } while (p != null);

            } catch (LookaheadSuccess ls) { }
        }
        jj_rescan = false;
    }

    private void jj_save(int index, int xla) {
        JJCalls p = jj_2_rtns[index];
        while (p.gen > jj_gen) {
            if (p.next == null) {
                p = p.next = new JJCalls();
                break;
            }
            p = p.next;
        }

        p.gen = jj_gen + xla - jj_la;
        p.first = token;
        p.arg = xla;
    }

    static final class JJCalls {
        int gen;
        Token first;
        int arg;
        JJCalls next;
    }

}
